<?php


namespace common\service;



class OAuthService
{
    /**
     * 增加消耗工时
     * @param int $userId
     * @param string $workDateFrom
     * @param string $workDateTo
     * @param $hour
     * @return array|mixed|\Yurun\Util\YurunHttp\Http\Response
     */
    public function increaseCostWorkHour(int $userId, string $workDateFrom, string $workDateTo, $hour)
    {
        $requestData = [
            'param' => [
                'filter' => [
                    'work_date_from' => $workDateFrom,
                    'work_date_to' => $workDateTo,
                    'user_id' => $userId,
                    'work_hour' => $hour,
                ]
            ]
        ];
        return teamones_request('teamones-oauth', 'ding_talk/increase_cost_work_hour', $requestData);
    }

    /**
     * 回滚消耗工时
     * @param int $userId
     * @param string $workDateFrom
     * @param string $workDateTo
     * @param $hour
     * @return array|mixed|\Yurun\Util\YurunHttp\Http\Response
     */
    public function decreaseCostWorkHour(int $userId, string $workDateFrom, string $workDateTo, $hour)
    {
        $requestData = [
            'param' => [
                'filter' => [
                    'work_date_from' => $workDateFrom,
                    'work_date_to' => $workDateTo,
                    'user_id' => $userId,
                    'work_hour' => $hour,
                ]
            ]
        ];
        return teamones_request('teamones-oauth', 'ding_talk/decrease_cost_work_hour', $requestData);
    }
}
